﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;

namespace MyAccess
{
   public  class Access
    {

       public string ATest(string name)
       {
           var str = string.Empty;
           using (var db = new BlogContext())
           {
               db.Blogs.Add(new Blog { Name = name,Url="aaa" });
               db.SaveChanges();

               foreach (var blog in db.Blogs)
               {
                   str += blog.Name + "|";
                   //Console.WriteLine(blog.Name);
               }
           }
           return str;
       
       }


       public string BTest(Post p)
       {
           var str = string.Empty;
           using (var db = new PostContext())
           {
               db.Posts.Add(p);
               db.SaveChanges();

               foreach (var post in db.Posts)
               {
                   str += post.Title + "|";
                   //Console.WriteLine(blog.Name);
               }
           }
           return str;

       }

    }
}
